﻿Imports Microsoft.Practices.Composite.Modularity
Imports Microsoft.Practices.Unity
Imports EHaskins.Frc.Dashboard

Public Class CoreModule
    Implements IModule
    Dim _container As IUnityContainer
    Dim _dashboard As IDashboardClient
    ''' <summary>
    ''' Initializes a new instance of the CoreModule class.
    ''' </summary>
    ''' <param name="container"></param>
    Public Sub New(ByVal container As IUnityContainer)
        _container = container
    End Sub
    Public Sub Initialize() Implements IModule.Initialize
        RegisterServices()
        Dim dash = _container.Resolve(Of IDashboardClient(Of IFrcDashUserDataProcessor))()
        dash.BeginUpdating()
        Dim ctrlr = _container.Resolve(Of IDashboardController)()
    End Sub
    Private Sub RegisterServices()
        _container.RegisterType(Of IFrcDashUserDataProcessor, FrcDashUserDataProcessor) _
                                (New ContainerControlledLifetimeManager())
        _container.RegisterType(Of IDashboardClient(Of IFrcDashUserDataProcessor), DashboardClient(Of IFrcDashUserDataProcessor)) _
                                (New ContainerControlledLifetimeManager)
        _container.RegisterType(Of IDashboardController, DashboardController) _
                                (New ContainerControlledLifetimeManager())
    End Sub
End Class
